<template>
  <view class="product-card">
    <image class="product-image" :src="product.image" mode="aspectFill" />
    <view class="product-info">
      <text class="product-name">{{product.name}}</text>
      <text class="product-spec">{{product.spec}}</text>
      <view class="price-line">
        <text class="product-price">¥{{product.price}}</text>
        <text class="product-quantity">×{{product.quantity}}</text>
      </view>
    </view>
  </view>
</template>

<script setup>
defineProps({
  product: {
    type: Object,
    required: true
  }
})
</script>

<style lang="scss">
.product-card {
  display: flex;
  padding: 30rpx;
  border-bottom: 1rpx solid #f5f5f5;
  
  .product-image {
    width: 160rpx;
    height: 160rpx;
    border-radius: 8rpx;
    margin-right: 20rpx;
  }
  
  .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    
    .product-name {
      font-size: $font-size-28rpx;
      @include text-ellipsis(2);
    }
    
    .product-spec {
      font-size: 24rpx;
      color: #999;
    }
    
    .price-line {
      display: flex;
      justify-content: space-between;
      align-items: center;
      
      .product-price {
        font-size: $font-size-30rpx;
        color: $primary-color;
        font-weight: bold;
      }
      
      .product-quantity {
        font-size: 26rpx;
        color: $text-color-666;
      }
    }
  }
}
</style>